<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
test
<input type="text" name="test1" value="test1"/>
<input type="text" name="test1" id="test" value=""/>
<script>
    //假设这是iframe页
    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
    //console.log(index);
    //parent.layer.close(index); //再执行关闭
</script>
</body>
</html>